import axios from './index'

export const getUsers = (params) => {
  return axios.request({
    url: '/userServlet/getUser',
    data: params,
    method: 'post'
  })
}
export const addUser = (params) => {
  return axios.request({
    url: '/userServlet/addUser',
    method: 'post',
    data: params
  })
}
export const updateUser = (params) => {
  return axios.request({
    url: '/userServlet/updateUser',
    method: 'post',
    data: params
  })
}
export const login = params => {
  return axios.request({
    url: '/index/login',
    method: 'post',
    data: {
      userName: 'xz',
      password: '123'
    }
  })
}
/**
 * 帐户
 */
export const getAccount = (params) => {
  return axios.request({
    url: '/userServlet/getAccount',
    data: params,
    method: 'post'
  })
}
/**
 * 充值
 */
export const addAccount = (params) => {
  return axios.request({
    url: '/userServlet/addAccount',
    data: params,
    method: 'post'
  })
}
/**
 * 查询商品
 */
export const getCommodity = (params) => {
  return axios.request({
    url: '/commodityServlet/getCommodity',
    data: params,
    method: 'post'
  })
}
/**
 *
 * @param {新增商品} params
 */
export const addCommodity = (params) => {
  return axios.request({
    url: '/commodityServlet/addCommodity',
    data: params,
    method: 'post'
  })
}
/**
 *
 * @param {修改商品} params
 */
export const updateCommodity = (params) => {
  return axios.request({
    url: '/commodityServlet/updateCommodity',
    data: params,
    method: 'post'
  })
}

/**
 *
 * @param {新增购物车} params
 */
export const getShoppingCart = (params) => {
  return axios.request({
    url: '/shoppingCartServlet/getShoppingCart',
    data: params,
    method: 'post'
  })
}
/**
 *
 * @param {查询购物车} params
 */
export const addShoppingCart = (params) => {
  return axios.request({
    url: '/shoppingCartServlet/addShoppingCart',
    data: params,
    method: 'post'
  })
}
/**
 *
 * @param {新增订单} params
 */
export const addOrder = (params) => {
  return axios.request({
    url: '/orderServlet/addOrder',
    data: params,
    method: 'post'
  })
}
/**
 *
 * @param {查询订单} params
 */
export const getOrder = (params) => {
  return axios.request({
    url: '/orderServlet/getOrder',
    data: params,
    method: 'post'
  })
}
